<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button id="btn" onclick="btnOnclick()">点击</button>
    <p id="text"></p>

</body>
<script>

var btn = document.querySelector('#btn');
var p = document.querySelector('#text');
var clickCount = function(){
    var count = 0;
    function click(){
      return count++;
    }
    return click;
}
var n = clickCount();
 function btnOnclick(){
   p.innerHTML = this.n();
};

</script>
</html>